package com.itheima.health.dao;

import com.itheima.health.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @description ：用户DAO
 */
@Mapper
public interface UserDao {

    /**
     * 根据userName查询
     * @param username
     * @return
     */
    User selectByUsername(@Param("username") String username);
//查询是否已注册
    @Select("select count(*) from t_user where telephone=#{telephone} ")
    Integer getByTelephone(String telephone);
//新增用户
    @Insert("insert into t_user (username, password,  telephone) values (#{username},#{password} ,#{telephone} )")
    void Insert(User users);
//查询用户
    @Select("select *from t_user where telephone= #{telephone} ")
    User getuser(String telephone);

}
